package com.huabo.session;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Jackie Liu on 2017/4/3.
 */
public interface UserSession {

    /**
     * 设置sessionModel对象到会话中
     * @param request
     * @param response
     * @param sessionModel
     * @return
     */
    public boolean setSessionModel(HttpServletRequest request, HttpServletResponse response, SessionModel sessionModel);

    /**
     * 从会话中获取sessionModel对象
     * @param request
     * @return
     */
    public SessionModel getSessionModel(HttpServletRequest request);

    /**
     * 解绑session
     * @param request
     * @param response
     * @return
     */
    public boolean removeSession(HttpServletRequest request, HttpServletResponse response);

    /**
     * 重置session有效期
     * @param request
     */
    public void resetSessionTime(HttpServletRequest request);

    /**
     * 设置验证码
     * @param request
     * @param response
     */
    public void setVerifyCode(HttpServletRequest request, HttpServletResponse response, String verifyCode);

    /**
     * 获取验证码
     * @param request
     * @param response
     * @return
     */
    public String getVerifyCode(HttpServletRequest request, HttpServletResponse response);
}
